#include "mypushbutton.h"

MyPushButton::MyPushButton(QString normalImg,QString pressImg, int W, int H)
{
    this->normalImgPath = normalImg;
    this->pressImgPath = pressImg;
    QPixmap pix;
    if(!pix.load(normalImg))
    {
        // qDebug()<<"图片加载失败";
        return;
    }
    if( H == -1){H = pix.height();}
    if( W == -1){W = pix.width();}
    this->setFixedSize(W,H);
    this->setStyleSheet("QPushButton{border:0px}");
    QPixmap npix = pix.scaled(W,H,Qt::IgnoreAspectRatio);
    this->setIcon(npix);
    this->setIconSize(QSize(W,H));
}
